﻿using MVCProject.UI;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _250210作业.UI.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(string Name, string Pwd)
        {
            Result result = new Result();
            if (Name == "刘江辉" && Pwd == "250")
            {
                Session["uid"] = "250";
                result.msg = "登录成功！";
                string strjson = JsonConvert.SerializeObject(result);
                return Content(strjson, "application/json");
            }
            else
            {
                result.code = -1;
                result.msg = "账户或者密码错误！";
                string strjson = JsonConvert.SerializeObject(result);
                return Content(strjson, "application/json");
            }
        }
    }
}
